﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="PUBLISHERS.aspx.vb" Inherits="PRUEVANET3.Formulario_web15" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
        BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" 
        CellPadding="4" DataKeyNames="pub_id" DataSourceID="SqlDataSource1" 
        EmptyDataText="No hay registros de datos para mostrar." GridLines="Horizontal">
        <Columns>
            <asp:BoundField DataField="pub_id" HeaderText="pub_id" ReadOnly="True" 
                SortExpression="pub_id" />
            <asp:BoundField DataField="pub_name" HeaderText="pub_name" 
                SortExpression="pub_name" />
            <asp:BoundField DataField="city" HeaderText="city" SortExpression="city" />
            <asp:BoundField DataField="state" HeaderText="state" SortExpression="state" />
            <asp:BoundField DataField="country" HeaderText="country" 
                SortExpression="country" />
        </Columns>
        <FooterStyle BackColor="White" ForeColor="#333333" />
        <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="White" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F7F7F7" />
        <SortedAscendingHeaderStyle BackColor="#487575" />
        <SortedDescendingCellStyle BackColor="#E5E5E5" />
        <SortedDescendingHeaderStyle BackColor="#275353" />
    </asp:GridView>
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="pub_id" 
        DataSourceID="SqlDataSource2">
        <EditItemTemplate>
            pub_id:
            <asp:Label ID="pub_idLabel1" runat="server" Text='<%# Eval("pub_id") %>' />
            <br />
            pub_name:
            <asp:TextBox ID="pub_nameTextBox" runat="server" 
                Text='<%# Bind("pub_name") %>' />
            <br />
            city:
            <asp:TextBox ID="cityTextBox" runat="server" Text='<%# Bind("city") %>' />
            <br />
            state:
            <asp:TextBox ID="stateTextBox" runat="server" Text='<%# Bind("state") %>' />
            <br />
            country:
            <asp:TextBox ID="countryTextBox" runat="server" Text='<%# Bind("country") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Actualizar" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
        </EditItemTemplate>
        <InsertItemTemplate>
            pub_id:
            <asp:TextBox ID="pub_idTextBox" runat="server" Text='<%# Bind("pub_id") %>' />
            <br />
            pub_name:
            <asp:TextBox ID="pub_nameTextBox" runat="server" 
                Text='<%# Bind("pub_name") %>' />
            <br />
            city:
            <asp:TextBox ID="cityTextBox" runat="server" Text='<%# Bind("city") %>' />
            <br />
            state:
            <asp:TextBox ID="stateTextBox" runat="server" Text='<%# Bind("state") %>' />
            <br />
            country:
            <asp:TextBox ID="countryTextBox" runat="server" Text='<%# Bind("country") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insertar" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancelar" />
        </InsertItemTemplate>
        <ItemTemplate>
            pub_id:
            <asp:Label ID="pub_idLabel" runat="server" Text='<%# Eval("pub_id") %>' />
            <br />
            pub_name:
            <asp:Label ID="pub_nameLabel" runat="server" Text='<%# Bind("pub_name") %>' />
            <br />
            city:
            <asp:Label ID="cityLabel" runat="server" Text='<%# Bind("city") %>' />
            <br />
            state:
            <asp:Label ID="stateLabel" runat="server" Text='<%# Bind("state") %>' />
            <br />
            country:
            <asp:Label ID="countryLabel" runat="server" Text='<%# Bind("country") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Editar" />
            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Eliminar" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="Nuevo" />
        </ItemTemplate>
    </asp:FormView>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConflictDetection="CompareAllValues" 
        ConnectionString="<%$ ConnectionStrings:PUBSConnectionString %>" 
        DeleteCommand="DELETE FROM [publishers] WHERE [pub_id] = @original_pub_id AND (([pub_name] = @original_pub_name) OR ([pub_name] IS NULL AND @original_pub_name IS NULL)) AND (([city] = @original_city) OR ([city] IS NULL AND @original_city IS NULL)) AND (([state] = @original_state) OR ([state] IS NULL AND @original_state IS NULL)) AND (([country] = @original_country) OR ([country] IS NULL AND @original_country IS NULL))" 
        InsertCommand="INSERT INTO [publishers] ([pub_id], [pub_name], [city], [state], [country]) VALUES (@pub_id, @pub_name, @city, @state, @country)" 
        OldValuesParameterFormatString="original_{0}" 
        SelectCommand="SELECT * FROM [publishers]" 
        UpdateCommand="UPDATE [publishers] SET [pub_name] = @pub_name, [city] = @city, [state] = @state, [country] = @country WHERE [pub_id] = @original_pub_id AND (([pub_name] = @original_pub_name) OR ([pub_name] IS NULL AND @original_pub_name IS NULL)) AND (([city] = @original_city) OR ([city] IS NULL AND @original_city IS NULL)) AND (([state] = @original_state) OR ([state] IS NULL AND @original_state IS NULL)) AND (([country] = @original_country) OR ([country] IS NULL AND @original_country IS NULL))">
        <DeleteParameters>
            <asp:Parameter Name="original_pub_id" Type="String" />
            <asp:Parameter Name="original_pub_name" Type="String" />
            <asp:Parameter Name="original_city" Type="String" />
            <asp:Parameter Name="original_state" Type="String" />
            <asp:Parameter Name="original_country" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="pub_id" Type="String" />
            <asp:Parameter Name="pub_name" Type="String" />
            <asp:Parameter Name="city" Type="String" />
            <asp:Parameter Name="state" Type="String" />
            <asp:Parameter Name="country" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="pub_name" Type="String" />
            <asp:Parameter Name="city" Type="String" />
            <asp:Parameter Name="state" Type="String" />
            <asp:Parameter Name="country" Type="String" />
            <asp:Parameter Name="original_pub_id" Type="String" />
            <asp:Parameter Name="original_pub_name" Type="String" />
            <asp:Parameter Name="original_city" Type="String" />
            <asp:Parameter Name="original_state" Type="String" />
            <asp:Parameter Name="original_country" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:pubsConnectionString8 %>" 
        DeleteCommand="DELETE FROM [publishers] WHERE [pub_id] = @original_pub_id AND (([pub_name] = @original_pub_name) OR ([pub_name] IS NULL AND @original_pub_name IS NULL)) AND (([city] = @original_city) OR ([city] IS NULL AND @original_city IS NULL)) AND (([state] = @original_state) OR ([state] IS NULL AND @original_state IS NULL)) AND (([country] = @original_country) OR ([country] IS NULL AND @original_country IS NULL))" 
        InsertCommand="INSERT INTO [publishers] ([pub_id], [pub_name], [city], [state], [country]) VALUES (@pub_id, @pub_name, @city, @state, @country)" 
        ProviderName="<%$ ConnectionStrings:PUBSConnectionString.ProviderName %>" 
        SelectCommand="SELECT [pub_id], [pub_name], [city], [state], [country] FROM [publishers]" 
        
    UpdateCommand="UPDATE [publishers] SET [pub_name] = @pub_name, [city] = @city, [state] = @state, [country] = @country WHERE [pub_id] = @original_pub_id AND (([pub_name] = @original_pub_name) OR ([pub_name] IS NULL AND @original_pub_name IS NULL)) AND (([city] = @original_city) OR ([city] IS NULL AND @original_city IS NULL)) AND (([state] = @original_state) OR ([state] IS NULL AND @original_state IS NULL)) AND (([country] = @original_country) OR ([country] IS NULL AND @original_country IS NULL))" 
    ConflictDetection="CompareAllValues" 
    OldValuesParameterFormatString="original_{0}">
        <DeleteParameters>
            <asp:Parameter Name="original_pub_id" Type="String" />
            <asp:Parameter Name="original_pub_name" Type="String" />
            <asp:Parameter Name="original_city" Type="String" />
            <asp:Parameter Name="original_state" Type="String" />
            <asp:Parameter Name="original_country" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="pub_id" Type="String" />
            <asp:Parameter Name="pub_name" Type="String" />
            <asp:Parameter Name="city" Type="String" />
            <asp:Parameter Name="state" Type="String" />
            <asp:Parameter Name="country" Type="String" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="pub_name" Type="String" />
            <asp:Parameter Name="city" Type="String" />
            <asp:Parameter Name="state" Type="String" />
            <asp:Parameter Name="country" Type="String" />
            <asp:Parameter Name="original_pub_id" Type="String" />
            <asp:Parameter Name="original_pub_name" Type="String" />
            <asp:Parameter Name="original_city" Type="String" />
            <asp:Parameter Name="original_state" Type="String" />
            <asp:Parameter Name="original_country" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
